<template>
  <div>
     <!-- 登陆页面 -->
     <div class="Y3head">
        <div class="Y3phone">
            <div class="Y3p"><img src="../assets/img/箭头.png" alt="" width="20px" height="20px"></div>          
            <span>尊敬的用户，您好</span>
        </div>
        <input type="text" id="Y3iphone"  placeholder="请输入手机号" v-model="number">
        <div class="Y3check">
            <div class="Y3check1">
                <input type="checkbox" id="Y3box">
                <div class="Y3check1-1">
                    <span class="Y3black">已阅读并同意<span class="Y3blue">《网络金融个人客户服务协议》</span>和<br><span
                            class="Y3blue">《中国农业银行股份有限公司隐私政策(个人版)》</span></span>
                </div>
            </div>
            <div class="Y3check2">
                <input type="checkbox" id="Y3box1">
                <div class="Y3check2-1">
                    <span class="Y3black">已阅读并同意<span class="Y3blue">《信息接受同意书(个人版)》</span></span>
                </div>
            </div>
        </div>
        <button  id="Y3botton2" @click="fun">登录/注册</button>
    </div>
  </div>
</template>

<script>
import {Dialog} from 'vant';
import {ff} from "../api/Longin"
export default {
    data(){
        return{
            number:""
        }
    },
    methods:{
        // 弹框
        fun(){  
            let admin = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/
            if (this.number == "") {
                c
            }else if(admin.test(this.number) ){
                ff({phone:this.number}).then((res)=>{
                if (res.data == 1) {
                    localStorage.setItem("iphone",this.number)
                    //登录 给下一个页面传电话号
                    this.$router.push({
                        name:"enroll",
                        params:{
                            Number:this.number,
                        }
                    })
                }else if(res.data == 0){
                    // 跳注册页
                    this.$router.push({
                        name:"Register",
                        params:{
                            Number:this.number,
                        }
                    })
                }
            }).catch((err)=>{
                console.log(err);
            })
            }else{
                Dialog({title: '温馨提示', message: '请输入正确的手机号' });
            }
            
            
        }
        
    }
}
</script>

<style scoped src="../assets/css/longin.css">

</style>